<?php
// 获取默认风格配置
$host = 'localhost';
$dbname = 'itops_help1_center';
$username = 'itops_help1_center';
$password = 'itops_help1_center';
$style = ['primary_color' => '#2563eb', 'secondary_color' => '#64748b', 'font_family' => 'Segoe UI, system-ui', 'layout_type' => 1];

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
    $stmt = $pdo->query("SELECT * FROM style_config WHERE is_default=1 LIMIT 1");
    $defaultStyle = $stmt->fetch(PDO::FETCH_ASSOC);
    if ($defaultStyle) $style = $defaultStyle;
} catch (Exception $e) {
    // 数据库连接失败则使用默认风格
}

// 输出CSS变量
echo "<style>";
echo ":root {";
echo "--primary: {$style['primary_color']};";
echo "--secondary: {$style['secondary_color']};";
echo "--font: {$style['font_family']};";
echo "--layout-padding: " . ($style['layout_type'] == 1 ? '15px' : '30px') . ";";
echo "}";
echo "</style>";